﻿#include "DataRepository.h"
#include "MyPublicMacro.h"

CDataRepository*  CDataRepository::_pDataRepository = nullptr;

CDataRepository::CDataRepository()
{
}

CDataRepository::~CDataRepository()
{
}

CDataRepository* CDataRepository::getInstance()
{
	if (_pDataRepository == nullptr)
	{
		_pDataRepository = CDataRepository::create();
		assert(_pDataRepository);
	}

	return _pDataRepository;
}

CDataRepository* CDataRepository::create()
{
	CDataRepository *_pDataRepository = new(std::nothrow) CDataRepository();
	if (_pDataRepository && _pDataRepository->init())
	{
		return _pDataRepository;
	}
	else
	{
		delete _pDataRepository;
		_pDataRepository = nullptr;
		return nullptr;
	}
}

void CDataRepository::destoryInstance()
{
	if (_pDataRepository != nullptr)
	{
		delete _pDataRepository;
		_pDataRepository = nullptr;
	}
}

bool CDataRepository::init()
{

	return true;
}